package com.juzi.xunhuan_while;

public class JieShao {
    public static void main(String[] args) {
        System.out.println("======================\n" +
                "while 循环格式与执行流程\n" +
                "初始化语句;\n" +
                "while (循环条件) {\n" +
                "    循环体语句(被重复执行的代码);\n" +
                "    迭代语句;\n" +
                "}\n" +
                "\n" +
                "示例：\n" +
                "int i = 0;\n" +
                "while (i < 3) {\n" +
                "    System.out.println(\"Hello World\");\n" +
                "    i++;\n" +
                "}\n" +
                "---------------------------\n" +
                "while循环的格式，执行流程是怎么样的？\n" +
                "初始化语句;                            int i = 0;\n" +
                "while (循环条件) {                     while (i < 3) {\n" +
                "    循环体语句;                             System.out.println(\"Hello World\");\n" +
                "    迭代语句;                              i++;\n" +
                "}                                     }\n" +
                "---------------------------\n" +
                "2、什么时候用for循环，什么时候用while循环？\n" +
                "功能上是完全一样的，for能解决的while也能解决，反之亦然。\n" +
                "使用规范是：知道循环几次：使用for；不知道循环几次建议使用：while。\n");
    }
}
